require 'rake'
require_relative 'assets_tasks'

namespace :bootstrap do
  BOOTSTRAP_URL = "http://twitter.github.com/bootstrap/assets/bootstrap.zip"

  desc "Install Bootstrap in assets/ directory"
  task :install => [:create_assets, :download, :unzip, :clean]

  task :create_assets do
    Rake::Task["assets:create"].invoke
  end
  task :download do
    sh "wget #{BOOTSTRAP_URL} -O assets/bootstrap.zip -q"
  end
  task :unzip, :target_file do
    sh "unzip -q -o assets/bootstrap.zip -d assets/"
  end
  desc "Remove Bootstrap from assets/ directroy"
  task :remove do
    if File.exist? "assets/bootstrap"
      rm_rf "assets/bootstrap"
      Rake::Task["assets:clean"].invoke
    else
      abort "It seems that Bootstrap is not installed"
    end
  end
  task :clean do
    rm_rf "assets/bootstrap.zip"
  end
end
